{{--快婚--}}
@extends("base")
@section("css")
    <link rel="stylesheet" href="{{asset('/css/amazeui.min.css')}}">
    <link rel="stylesheet" href="{{asset('/css/animate.min.css')}}">
    <link rel="stylesheet" href="{{asset('/css/iconfont.css')}}">
@stop
@section("content")
    <div class="get mt80">
        <div class="am-g">
            <div class="am-u-lg-12">
                <div class="get-title">
                    <div class="get_font_left"><img src="{{asset('/img/font_yjy.png')}}"></div>
                    <div class="get_font_center" id="banner_num">359590</div>
                    <div class="get_font_rigth"><img src="{{asset('/img/font_zty.png')}}"></div>
                </div>
                <div class="font_line"><img src="{{asset('/img/font_line.png')}}"></div>
            </div>
        </div>
    </div>
    <div class="am-g">
        <div class="banner_nav mt20"><span class="am-icon-caret-right"> <i class="iconfont icon-shaixuan"></i> 筛选：</span>
            @foreach($nav_list[$fatherId]['data'] as $nav)
               <a href="{{url('/marriage/index/'.$nav['categoryid'])}}" class="click_bjtj @if($nav['categoryid'] == $id) banner_hover @endif">{{$nav['name']}}</a>
            @endforeach
        </div>
    </div>

    <div class="am-g am-imglist" style="padding-top: 0;">
        <ul data-am-widget="gallery" class="am-gallery am-avg-sm-2 am-avg-md-3 am-avg-lg-6 am-gallery-default am_index_addimglist">
            @foreach($lists as $key=>$item)
                <?php $img = explode(',',$item->imgurl)[0] ?>
                <?php $img = str_replace('145-83','330-330',$img) ?>
                <li style="width: 330px;">
                    <div class="am-gallery-item am_list_block">
                        <a href="{{url('marriage/detail/'.$item->jobid)}}" class="am_img_bg">
                            <img class="am_img animated" src="{{asset($img)}}" />
                        </a>
                        <div class="am_listimg_info">
                            <span class="am-icon-heart"><i class="iconfont icon-xinshixin"></i>{{$item->name}}</span>
                            <span class="am-icon-comments"><i class="iconfont icon-duihua"></i>{{$item->addr}}</span>
                            <span class="am_imglist_time" style="float: right">{{date('Y-m-d' ,strtotime( $item->pubtime))}}</span>
                        </div>
                    </div>
                </li>
            @endforeach
        </ul>
        {{--<div class="am_news_load am_news_load_index"><span><i  class="am-icon-spinner am-icon-spin"></i>加载更多</span></div>--}}
        <div class="pagelist">{{ $lists->render() }}</div>
    </div>
@stop
@section("js")
    <script type="javascript">
        var page     = 1;
        var pagesize = 4;
        var datalist = 'indexrecommendlist';
        $(function(){
            load_more();
            var options = {
                useEasing : true,
                useGrouping : true,
                separator : '',
                decimal : '.',
                prefix : '',
                suffix : ''
            };
            var banner_num = new CountUp("banner_num", 359590-500, 359590, 0, 5, options);
            banner_num.start();
        });
        function load_more()
        {
            var indexListHtml = '';
            $('.am_news_load_index').unbind('click');
            $.post('/v2/'+datalist+'',{page:page,pagesize:pagesize},function(data){

                $('.am-icon-spinner').hide();
                // 数据异常
                if(data.code != 100)
                {
                    console.log(data.msg);
                    return false;
                }
                for( var i = 0 ; i < data.data.list.length ; i++ ){
                    indexListHtml += '<li><div class="am-gallery-item am_list_block"><a href="/g/'+data.data.list[i].id+'.html" class="am__bg">< class="am_ animated" src="http://assets.petshow.cc/pc/v2//loading.gif" data-original="'+data.data.list[i].picture+'" /></a><div class="am_list_info"><span class="am-icon-heart">'+data.data.list[i].like_num+'</span><span class="am-icon-comments">'+data.data.list[i].comment_num+'</span><span class="am_list_time">'+data.data.list[i].create_time+'</span></div></div><a class="am_list_user"><span class="am_list_user_ico"><img src="'+data.data.list[i].user.avatar+'" alt=""></span><span class="am_list_user_font">'+data.data.list[i].user.nick+'</span></a></li>';
                }
                $('.am_index_addlist').append(indexListHtml);
                // 懒加载
                $(".am_").lazyload();
                $("a.am__bg").lazyload({
                    effect : 'fadeIn'
                });
                // 点击加载更多
                $('.am_news_load_index').on('click',function(){
                    $('.am-icon-spinner').show();
                    if(data.data.page_data.page < data.data.page_data.page_total ){
                        load_more(page,pagesize);
                    }
                });
                page++;
            },'json');

        }
    </script>
@stop